package com.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.utils.UserDateSerializer;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

public class User {

    private int id;
    private String username;
    private String password;
    @DateTimeFormat(pattern = "yyyy/MM/dd")
    @JsonFormat(pattern = "yyyy/MM/dd", timezone = "GMT+8")
    @JsonSerialize(using = UserDateSerializer.class)
    private Date birthdate;
    private String role; //用户角色
    private String[] Authority; //权限
    public User() {
    }

    public User(int id, String username, String password, Date birthdate, String role, String[] authority) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.birthdate = birthdate;
        this.role = role;
        Authority = authority;
    }


    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", birthdate=" + birthdate +
                ", role='" + role + '\'' +
                ", Authority=" + Arrays.toString(Authority) +
                '}';
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String[] getAuthority() {
        return Authority;
    }

    public void setAuthority(String[] authority) {
        Authority = authority;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Date getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(Date birthdate) {
       this.birthdate = birthdate;
    }

}
